FROM ubuntu:22.04
MAINTAINER suke119
RUN apt-get update && apt-get install -y \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    ffmpeg \
    wget \
    bzip2

# 下载并安装Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh && \
    chmod +x Miniconda3-py37_4.10.3-Linux-x86_64.sh && \
    ./Miniconda3-py37_4.10.3-Linux-x86_64.sh -b -p /opt/conda && \
    rm Miniconda3-py37_4.10.3-Linux-x86_64.sh

# 将Miniconda添加到环境变量中
ENV PATH="/opt/conda/bin:${PATH}"

# 创建并激活Python 3.7环境
RUN conda create -y --name py37 python=3.7 && \
    echo "source activate py37" >> ~/.bashrc
ENV PATH="/opt/conda/envs/py37/bin:${PATH}"

WORKDIR /app

COPY ./server /app

RUN pip install --upgrade pip -i https://pypi.douban.com/simple && \
    pip uninstall -y protobuf && \
    pip install protobuf==3.19.0 -i https://pypi.douban.com/simple && \
    pip install -r requirements.txt -i https://pypi.douban.com/simple
RUN pip install opencv-python-headless -i https://pypi.douban.com/simple
CMD uvicorn main:app --reload --port 18080 --host 0.0.0.0



